﻿cmake_minimum_required(VERSION 3.14)

project(Pybind11Lib LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 加入依赖库
add_subdirectory(pybind11-2.12.0)

# 这里决定了模块的名字,此处是${PROJECT_NAME},下面跟的是资源文件
file(GLOB SourceFiles *.cpp *.h)
pybind11_add_module(${PROJECT_NAME}
        ${SourceFiles}
)

#INSTALL(TARGETS ${PROJECT_NAME}
#        RUNTIME DESTINATION bin
#        ARCHIVE DESTINATION lib
#)

target_link_libraries(${PROJECT_NAME}
        PRIVATE
        Pybind11OtherLib
)

# 将.pyd拷贝到bin中
file(GLOB NeedCopyFiles ${CMAKE_BINARY_DIR}/lib/*.pyd)
file(COPY ${NeedCopyFiles} DESTINATION ${CMAKE_BINARY_DIR}/bin)
#execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${NeedCopyFiles} ${CMAKE_BINARY_DIR}/bin)
